package com.atguigu.multiReading;

import java.util.concurrent.BlockingDeque;
import java.util.concurrent.LinkedBlockingDeque;

public class Demo2 {
    public static void main(String[] args) throws InterruptedException {
        BlockingDeque<Integer> blockingDeque=new LinkedBlockingDeque<>(100);
        blockingDeque.put(1); //offer方法是可以使用，但是put是带有阻塞功能的
        blockingDeque.put(2);
        blockingDeque.put(3);
        Integer ret=blockingDeque.take(); //出队列
        System.out.println(ret);
        ret=blockingDeque.take();
        System.out.println(ret);
        ret=blockingDeque.take();
        System.out.println(ret);
        //此时会进行阻塞，因为三个元素都已经取出了
        ret=blockingDeque.take();
        System.out.println(ret);

    }
}
